import {handlePageChange, back2Home} from '../../router/index'
import Notify from '@vant/weapp/notify/notify';
Page({
  data: {
    active: 3,
    edit: false,
    user: {},
  },
  onLoad() {
    // 加载用户数据
    try {
      var user_id = wx.getStorageSync('user_id')
      if (user_id) {
        console.log(user_id)
        // Do something with return value
      } else {
        Notify({ type: 'warning', message: '请先登录', onClose: back2Home })
      }
    } catch (e) {
      Notify({ type: 'warning', message: '请先登录', onClose: back2Home })
    }
  },

  onPageChange(event) {
    handlePageChange(event.detail)
    this.setData({active: event.detail})
  },

  onEditChange(event) {
    console.log(event)
    this.setData({edit: !this.data.edit})
  }
});
